package com.indexingsystem.system.service.impl;

import com.github.pagehelper.PageHelper;
import com.indexingsystem.boss.Vo.IdxSynonymDetailReqVo;
import com.indexingsystem.boss.Vo.IdxSynonymDetailsListVo;
import com.indexingsystem.boss.admin.mapper.IdxSynonymDetailsMapper;
import com.indexingsystem.boss.common.PagedResult;
import com.indexingsystem.boss.entity.IdxSynonymDetails;
import com.indexingsystem.boss.utils.BeanUtils;
import com.indexingsystem.system.service.IdxSynonymDetailsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class IdxSynonymDetailsServiceImpl implements IdxSynonymDetailsService {

	@Resource
	private IdxSynonymDetailsMapper idxSynonymDetailsMapper;

	@Override
	public int deleteByPrimaryKey(String id) {
		return idxSynonymDetailsMapper.deleteByPrimaryKey( id );
	}

	@Override
	public int insert(IdxSynonymDetails record) {
		return idxSynonymDetailsMapper.insert( record );
	}

	@Override
	public int insertSelective(IdxSynonymDetails record) {
		return idxSynonymDetailsMapper.insertSelective( record );
	}

	@Override
	public IdxSynonymDetails selectByPrimaryKey(String id) {
		return idxSynonymDetailsMapper.selectByPrimaryKey( id );
	}

	@Override
	public int updateByPrimaryKeySelective(IdxSynonymDetails record) {
		return idxSynonymDetailsMapper.updateByPrimaryKeySelective( record );
	}

	@Override
	public int updateByPrimaryKey(IdxSynonymDetails record) {
		return idxSynonymDetailsMapper.updateByPrimaryKey( record );
	}

	@Override
	public PagedResult<IdxSynonymDetails> selectIdxSynonymDateisl(IdxSynonymDetailReqVo idxSynonymDetailReqVo) {
		Integer pageNo = idxSynonymDetailReqVo.getPageNo() == null ? 1 : idxSynonymDetailReqVo.getPageNo();
		Integer pageSize = idxSynonymDetailReqVo.getPageSize() == null ? 10 : idxSynonymDetailReqVo.getPageSize();
		// startPage是告诉拦截器说我要开始分页了。分页参数是这两个。
		PageHelper.startPage( pageNo, pageSize );
		return BeanUtils.toPagedResult( idxSynonymDetailsMapper.selectIdxSynonymDateisl( idxSynonymDetailReqVo ) );
	}

	@Override
	public Integer selectIdxSynonymDateislCount(IdxSynonymDetailReqVo idxSynonymDetailReqVo) {
		return idxSynonymDetailsMapper.selectIdxSynonymDateislCount(idxSynonymDetailReqVo);
	}

	@Override
	public Integer deleteByIdBatch(List<String> id) {
		return idxSynonymDetailsMapper.deleteByIdBatch( id );
	}

	@Override
	public List<IdxSynonymDetailsListVo> selectIdxSynonymDateislById(String id) {
		return idxSynonymDetailsMapper.selectIdxSynonymDateislById(id);
	}

}
